package com.espeaker.sdk.utils;

import org.apache.commons.codec.binary.Base64;

public class Base64Util {
	/*
	 * Base64解码
	 */
	public static String decodeStr(String pwd)  
    {  
        Base64 base64 = new Base64();  
        byte[] debytes = base64.decodeBase64(new String(pwd).getBytes());  
        return new String(debytes);  
    }  
	/*
	 * Base64编码
	 */
    public static String encodeStr(String pwd)  
    {  
        Base64 base64 = new Base64();  
        byte[] enbytes = base64.encodeBase64Chunked(pwd.getBytes());  
        return new String(enbytes);  
    }
    /*
	 * Base64编码
	 */
    public static String encodeStr(byte []b)  
    {  
        Base64 base64 = new Base64();  
        byte[] enbytes = base64.encodeBase64Chunked(b);  
        return new String(enbytes);  
    } 
}
